package com.cqjtu.store.system.controller;

import com.cqjtu.store.common.JwtUtils;
import com.cqjtu.store.common.PageVO;
import com.cqjtu.store.common.R;
import com.cqjtu.store.system.pojo.entity.ViewCnt;
import com.cqjtu.store.system.pojo.vo.FavoriteTopVo;
import com.cqjtu.store.system.pojo.vo.ViewCntProductVo;
import com.cqjtu.store.system.service.ViewCntService;
import com.cqjtu.store.user.pojo.vo.UserLoginVO;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @ProjectName: cqjtu-store
 * @Titile: ViewCntController
 * @Author: Lucky
 * @Description: 商品控制类
 */
@RestController
@RequestMapping("api/system")
public class ViewCntController {
    @Autowired
    private ViewCntService systemService;


    //商品访问次数
    @GetMapping("viewList")
    public R<List<ViewCntProductVo>> getProductCntList() {

        List<ViewCntProductVo> pageVO = systemService.getProductCntList();
        return R.ok(pageVO);
    }

    //商品被喜欢top10
    @GetMapping("favoriteList")
    public R<List<FavoriteTopVo>> getFavoriteTopList() {
        List<FavoriteTopVo> pageVO = systemService.getFavoriteTopList();
        return R.ok(pageVO);
    }

    @GetMapping("orderCnt")
    public R<Integer> getOrderCnt() {
        Integer pageVO = systemService.getOrderCnt();
        return R.ok(pageVO);
    }

    @GetMapping("orderToday")
    public R<Integer> getOrderToday() {
        Integer pageVO = systemService.getOrderToday();
        return R.ok(pageVO);
    }

    @GetMapping("orderTotal")
    public R<Integer> getOrderTotal() {
        Integer pageVO = systemService.getOrderTotal();
        return R.ok(pageVO);
    }
    @GetMapping("productTotal")
    public R<Integer> getProductTotal() {
        Integer pageVO = systemService.getProductTotal();
        return R.ok(pageVO);
    }
}
